from fastapi import APIRouter, Depends

from ..service import UserService

user_router = APIRouter(prefix="/users", tags=["Users"])


@user_router.get("/{user_id}")
async def get_user(
        user_id: int,
        service: UserService = Depends(UserService.create)):
    u = await service.get_user_by_id(user_id)
    if u is None:
        return {"message": "User not found"}
    else:
        return u
